UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gGxwLJLJlE+IHjL+Nv4AcTt4eRoTkadrxN5GZxeJ+8I=' 
WHERE 
  key_id = '1e784da41dc5982769b46d45bceab46cd26ad73669a5798436cf04e6b1540061' 
  AND (
    token = 'gGxwLJLJlE+IHjL+Nv4AcTt4eRoTkadrxN5GZxeJ+8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047