UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'saQL+A2zjoFtTVL+ZaRagaG4z8JNyV51blKTsBSoj4o=' 
WHERE 
  key_id = '223bb37fe7171ef9636d7c853939b905801286af1ddb379a74ba7a7bc26f4564' 
  AND (
    token = 'saQL+A2zjoFtTVL+ZaRagaG4z8JNyV51blKTsBSoj4o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041