UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w7QUii/xGVXNceJA/YMSoiTc30GYhiwMT4+I7apJqu8=' 
WHERE 
  key_id = 'f4bcca9e298735115dc8d83c2701d569639f76251dd7f670de017d8588ce85d9' 
  AND (
    token = 'w7QUii/xGVXNceJA/YMSoiTc30GYhiwMT4+I7apJqu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049