UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IDSbpeuer662B6syN035W1QJ8iUzoLFktxiIFjDXVME=' 
WHERE 
  key_id = 'b2d7bd8e6c984b61a216d531f5ad69e0f53b4b0bc71053a51eac1d757e192953' 
  AND (
    token = 'IDSbpeuer662B6syN035W1QJ8iUzoLFktxiIFjDXVME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036