UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5MhVY8H4BtOGhUt2BRxbuIV+kryv8cxXuNOk6LARQAE=' 
WHERE 
  key_id = 'ee10b9c2c3350e98b32900495504ad20869003d32f1c20281fab681c8217b7f8' 
  AND (
    token = '5MhVY8H4BtOGhUt2BRxbuIV+kryv8cxXuNOk6LARQAE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038