UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u8NDCvORVb5G/kCSEAbJyPvoZVUB/qDGzwPRR1CcwWw=' 
WHERE 
  key_id = 'a6c15ab0fae8c796fcade49519d90f9a460166d09f8197770d3417486a94a98b' 
  AND (
    token = 'u8NDCvORVb5G/kCSEAbJyPvoZVUB/qDGzwPRR1CcwWw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031