UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IF/wYQtqnGUQRkCCyi8RSwvs+akTcgAmPSeuMdP+B5o=' 
WHERE 
  key_id = 'b7cf779760a18547400afb29b2b65835d3cf67d88675f7a5381dfd775bde5ea6' 
  AND (
    token = 'IF/wYQtqnGUQRkCCyi8RSwvs+akTcgAmPSeuMdP+B5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040