UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iPoaqhTdv/SjTT4i0bK3SvaK+NeQnX7qkMnbitnMnh4=' 
WHERE 
  key_id = '18b460b9494783bb95f0ab324f6d0425249eb0761d800009e6355f7305e13e75' 
  AND (
    token = 'iPoaqhTdv/SjTT4i0bK3SvaK+NeQnX7qkMnbitnMnh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037