UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P5F2umhqUego4UiFwqCoGE+lrOwccsrZlZsphm0qxqI=' 
WHERE 
  key_id = '05aa2003f50f565aefcc4e70889226a1c8b3074902920807c086ea30cec9680c' 
  AND (
    token = 'P5F2umhqUego4UiFwqCoGE+lrOwccsrZlZsphm0qxqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051