UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o4XSapBzofe/t7is2h0js7/EfPYRkul9FfX1QqKrkiM=' 
WHERE 
  key_id = '835142c2b1dae661ff7912d3c31c8e50c858f2db21f1c79f53f6c4150403aa71' 
  AND (
    token = 'o4XSapBzofe/t7is2h0js7/EfPYRkul9FfX1QqKrkiM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027