UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm74nUFwDK2qeZ9/G5de3hvP7eIR0KTneSpZHkut5axE=' 
WHERE 
  key_id = '4b1648f0fa7c5d0c3252257f053a0b6ba8b6bf0dedb52a7baf27babea6cd51f6' 
  AND (
    token = 'm74nUFwDK2qeZ9/G5de3hvP7eIR0KTneSpZHkut5axE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038