UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oJltDPf6HlxRzDOM+1gAQvgQh500BDoevnvdS/xRn6M=' 
WHERE 
  key_id = '27d1231042db2c897979beaf2b2fafcdc528889cf306af87ffd4eb84baf0f5ca' 
  AND (
    token = 'oJltDPf6HlxRzDOM+1gAQvgQh500BDoevnvdS/xRn6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028