UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '02jRc3wTZuSA93IUyy8NaR7VlBZAO7S87PAQxdcNYxE=' 
WHERE 
  key_id = 'b29b5aad93344e54f7eebb725b8deca43985984283e8976d077863ed104c4ea9' 
  AND (
    token = '02jRc3wTZuSA93IUyy8NaR7VlBZAO7S87PAQxdcNYxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033