UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JALOzopclc/Me11ROulrS198qeHa0PxRatJROrGewBA=' 
WHERE 
  key_id = 'af5625d3d1f00e5baac5cfe1cb7225055d344feba7c19571f4afd869faadc891' 
  AND (
    token = 'JALOzopclc/Me11ROulrS198qeHa0PxRatJROrGewBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018