UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vivNT+j/L7ghki6Z8uZn6mr+L/SRsxUoe+oyZRD9Fts=' 
WHERE 
  key_id = '56512b8d1bd18b6a8ff93c1cc453991f60a3836ab862b2d38285d7dbbeaecb28' 
  AND (
    token = 'vivNT+j/L7ghki6Z8uZn6mr+L/SRsxUoe+oyZRD9Fts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035