UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oUPv0uHhKGFhmYA2SWHcpa4DA+CRfacWKaocOhCWX28=' 
WHERE 
  key_id = '0c16cbe1ae7ff1d5cf197c5cf94f8ce6ac3727f42b6c996019b0c8c6b39852a0' 
  AND (
    token = 'oUPv0uHhKGFhmYA2SWHcpa4DA+CRfacWKaocOhCWX28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034