UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P6TudbMXyt5Eh9AoAExFC55K/gXFK43Ss/RONBTuUgc=' 
WHERE 
  key_id = '60b07b20af5e0cff1c9a3d708fab68114c4c1f5c1f466d5800ed53ee6b39e387' 
  AND (
    token = 'P6TudbMXyt5Eh9AoAExFC55K/gXFK43Ss/RONBTuUgc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017