UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F372OS7r0waLBnvNssJ9gpMBn6VnaN/H7A1vwrivTjU=' 
WHERE 
  key_id = 'a3cd8f1ac2dd67c14051065c14f74a50b9a7512038280239ed500faecbe189ae' 
  AND (
    token = 'F372OS7r0waLBnvNssJ9gpMBn6VnaN/H7A1vwrivTjU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028