UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dl8Iy3tYHCXydi/g0UwAvpD27w4X9G0jw7H3kyluDxo=' 
WHERE 
  key_id = 'd0efe738433f12f08f15739e37baeb012535c2a21beaf669cb1700067cc6fced' 
  AND (
    token = 'Dl8Iy3tYHCXydi/g0UwAvpD27w4X9G0jw7H3kyluDxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043