UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K1bgK0e0OtPa0M0UZ5XTD5J1qv2uiM1x2iiHFvd/nFk=' 
WHERE 
  key_id = 'd0c1388d692db7021ec2caaa801a37173e8946c05326e71173eaee7359342c41' 
  AND (
    token = 'K1bgK0e0OtPa0M0UZ5XTD5J1qv2uiM1x2iiHFvd/nFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033