UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BWdbuy/TSgdd5dScoWEbwP4aAIk/tDb54Bu9K5u9YHA=' 
WHERE 
  key_id = 'd3fd1beba591ae9919daf877e194bcf907db1c501deb9291b822df78839309e3' 
  AND (
    token = 'BWdbuy/TSgdd5dScoWEbwP4aAIk/tDb54Bu9K5u9YHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042