UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XCQxr3zJ/I2XnyPiyvH5ei4uh0l3MdhX2TdqaLyc3u0=' 
WHERE 
  key_id = '6274422d0f47dccd4b1b9c65241feb4f61410736e162df21eb259be35521ea31' 
  AND (
    token = 'XCQxr3zJ/I2XnyPiyvH5ei4uh0l3MdhX2TdqaLyc3u0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052