UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XPzNn7Av/ylDsBve8JX2kGAqW9Cr3unT17cPMyujH1o=' 
WHERE 
  key_id = '77ea85344eec25a5478c7d8abded6284e86d5d48b2dafa4dc0e92b6b0704b8b4' 
  AND (
    token = 'XPzNn7Av/ylDsBve8JX2kGAqW9Cr3unT17cPMyujH1o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029