UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FdRi7S/ZrssZKDyX7+R5qkvp8Rh6NjOQUx4NpeDvKgw=' 
WHERE 
  key_id = 'd21ade8b589a5a1b65fd51bd9ecad329e9fcb1eccbfff415852e8b575dfbf307' 
  AND (
    token = 'FdRi7S/ZrssZKDyX7+R5qkvp8Rh6NjOQUx4NpeDvKgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030