UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oHp5GJRrs+MtkJ/F92Emlq3ruflF6iMSAVeF1Ky632k=' 
WHERE 
  key_id = '77c4e90928a626a81476c0edc0619e2643a7f370f401cb5ef1530072bc2a7711' 
  AND (
    token = 'oHp5GJRrs+MtkJ/F92Emlq3ruflF6iMSAVeF1Ky632k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038