UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gbMbEomY2az0yEnGNc15zfheyPk8lIsx+V/qGMi8qOw=' 
WHERE 
  key_id = '16425b8f19d2229fbfa7d5fb2f6d02f904d3babe7fc22fc6dce6db890ded1332' 
  AND (
    token = 'gbMbEomY2az0yEnGNc15zfheyPk8lIsx+V/qGMi8qOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045