UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wgg3gA+t2X/2YPB8Z1vgHG0bZDGHMqcKDRjfmFhQJXA=' 
WHERE 
  key_id = '9d620eead38a7e9ec53716a1769a638785239dd2322fbf6a3d217db7e8f3dd2b' 
  AND (
    token = 'wgg3gA+t2X/2YPB8Z1vgHG0bZDGHMqcKDRjfmFhQJXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030