UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aRB/yfyvSQAOCsKzugvD0TcXdKEpPBK2w8OyJmZLfVQ=' 
WHERE 
  key_id = '8b80ba574c592934fa0f3051409b34de92797cddceb7644d873ce7d5e10da69f' 
  AND (
    token = 'aRB/yfyvSQAOCsKzugvD0TcXdKEpPBK2w8OyJmZLfVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032