UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hK/JP7TZct1RAGZPrSqvl6Sr0feQuDE5nFfA5Mdj7XI=' 
WHERE 
  key_id = '659076f35193e57621008c8d0cf1147b0b3cd51cd0153f5d8c0c72ae40387638' 
  AND (
    token = 'hK/JP7TZct1RAGZPrSqvl6Sr0feQuDE5nFfA5Mdj7XI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052